package com.fangyi.yunmusic.controller.es;


import com.fangyi.yunmusic.pojo.es.AlbumCommentDocument;
import com.fangyi.yunmusic.pojo.es.PlaylistCommentDocument;
import com.fangyi.yunmusic.pojo.es.SongCommentDocument;
import com.fangyi.yunmusic.service.es.CommentSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class CommentSearchController {

    @Autowired
    private CommentSearchService commentSearchService;

    @GetMapping("/comment/search")
    public Object queryComment(Integer pageNum, Integer pageSize, String query) {
//        Page<SongCommentDocument> page
        Map<String ,Object> commentMap= commentSearchService.queryComment(pageNum, pageSize, query);
        return commentMap;
    }
    @GetMapping("/comment/song/search")
    public Object querySongComment(Integer pageNum, Integer pageSize, String query) {
        Page<SongCommentDocument> page=commentSearchService.querySongComment(pageNum, pageSize, query);
        return page;
    }
    @GetMapping("/comment/playlist/search")
    public Object queryPlaylistComment(Integer pageNum, Integer pageSize, String query) {
        Page<PlaylistCommentDocument> page=commentSearchService.queryPlaylistComment(pageNum, pageSize, query);
        return page;
    }
    @GetMapping("/comment/album/search")
    public Object queryAlbumComment(Integer pageNum, Integer pageSize, String query) {
        Page<AlbumCommentDocument> page=commentSearchService.queryAlbumComment(pageNum, pageSize, query);
        return page;
    }
//    @GetMapping("/comment/isexist")
//    public Object isExist(String id) {
//        return commentSearchService.isExistById(id);
//    }


}
